package com.nbjtjc.safe.api.safe;

import com.nbjtjc.safe.bean.Result;
import com.nbjtjc.safe.model.safe.SafeEnterprise;
import com.nbjtjc.safe.service.safe.EnterpriseServiceImpl;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/safe/enterprise")
@CrossOrigin("*")
public class EnterpriseController {

    @Autowired
    private EnterpriseServiceImpl enterpriseService;

    @PostMapping(value = "/search")
    public Result search( SafeEnterprise safeEnterprise){
        return  enterpriseService.search(safeEnterprise);
    }
    @PostMapping(value = "/add")
    public Result addEnterpriseService(@ApiParam @RequestBody SafeEnterprise safeEnterprise){
       return  enterpriseService.add(safeEnterprise);
    }

    @PostMapping(value = "/update")
    public Result updateEnterpriseService(@ApiParam @RequestBody SafeEnterprise safeEnterprise){
        return enterpriseService.update(safeEnterprise);
    }
    @PostMapping(value = "/delete")
    public Result deleteEnterpriseService( SafeEnterprise safeEnterprise){
        return enterpriseService.delete(safeEnterprise.getId());
    }


    @PostMapping("/businessLicense")
    public Result businessLicense(@RequestBody SafeEnterprise safeEnterprise){
        return enterpriseService.businessLicense(safeEnterprise.getFileKey());
    }
}
